If you're talking about trying to install Windows on the laptop drive connected as an extra disk on a PC which already had Windows, then no, it won't work.
If you're talking about putting the laptop hard disk drive (HDD) into the desktop as the only HDD, then no, it won't work either. When Windows installs, it will detect the hardware in the desktop, all the chipsets and any other hardware on the motherboard or on adapter cards, and install drivers for them and configure itself for that hardware. Then, when you remove that laptop HDD and put it into the laptop, Windows will boot configured for the wrong hardware and have the wrong drivers.
While it is possible to jump through a lot of hoops and remove the device drivers before moving the HDD to the laptop, and then have Windows discover the new devices/hardware on the laptop, why bother? You've gone through almost twice as much work and time as just installing it on the laptop to begin with. And you'd have to do this before Windows was activated on the desktop, otherwise it would fail activation on the laptop (it would think that license key was being used on two different computers).