Data is easy. Put your old hard disk in the new computer as a slave drive and copy the data across.Programs are much more difficult, as they often instal files in the Windows directories and entries in the registry. You nearly always have to reinstall from scratch.
If all else fails, you can try installing your existing hard disk in the new computer and booting from it. If you are really lucky, it will boot and then load the necessary drivers from the system disk. However, many people have found that the system won't even boot if it is XP - Win98 will almost always start and load the drivers.
With the size of hard drives as they are these days, I create a partition and copy all my program disks, including XP, onto it. Then whenever I want to add more features etc the installation goes ahead much faster.