There are two different questions here.
1- Can you install an OEM copy of XP or Vista onto a different computer than it originally came with?
You can install it, sure. But if the hardware is significantly different, you will probably fail at activation. Though, I have heard you get one "grace" activation every 12 months, so even if the computer is completely different if you haven't activated recently it may successfully activate.
2- Can you legally do so, according to the license?
Probably not, depends how much of the old computer is being used as the new one. I have heard that the license is tied to the motherboard, case, and hard drive, but I have also heard conflicting stories. For example, I know if you have a faulty motherboard and get it replaced you are not obligated to buy a new copy of windows just because you changed motherboards. IANAL, so don't take this as serious legal advice, but I personally don't think Microsoft could ever prove you broke an OEM license as long as you are using some portion of the original computer and the sticker is on the computer using the license.
This is a bit off topic, but Microsoft's dreamy OEM license is just unrealistic and every OEM manufacturer will go directly against the license agreement if computer repairs require, so I don't see it as being enforceable. What I am talking about is warranty service. If you have a Dell, and *any* part of it fails under warranty, you can get the part replaced and Dell will reload windows if required. Dell will *never* buy a second OEM license, or make you pay for a second OEM license, even if the hard drive and motherboard both fail. So, either Dell is conducting software piracy, or the rumors about OEM licenses being tied to any one piece of a computer are slightly exaggerated.