Do you mean your plugging the computers directly together or through a router. Through a router it will work but theres not much of a reason to. Directly together wouldn't work.
Now if you mean can you go through the internet and set up a local network between the two than yes you can do that. Thats exactly what its for, I used to have one setup between me and a friend but it was a long time ago.