If it's the same version that's licensed on the COA sticker on each machine, then you can simply change out the Product Key at Control Panel>System to use the old HD's install on the new machine.
It's rare that it will start up however, and may need help updating drivers by installing all Important and Optional Windows Updates after enabling
Automatically deliver drivers via Windows Update (Step 3). Then supply any still missing in Device Manager from the Compaq downoads webpage.
I'd use the new HD to get the suggested and vastly superior
Clean Reinstall - Factory OEM Windows 7.