This is a yes or no answer.
Is the CD you have a recovery cd or a full XP cd?
If its a full XP CD, yes you can.
If its a recovery CD, no you can because its an image of your HP and if you try to install it on the other computer/laptop, it wont work because the drivers are different.