Assuming that all of the receiving sizes are the same, then yes. Technically you can put parts sized for different wheel sizes on a frame meant for a specific wheel size (ala 69ers), but keep in mind that it will change the bike's handling and geometry.
- Fork: If both are 1 1/8" or both tapered then you can. Keep in mind that the head tube of the new frame may be shorter or longer and affect how much steer tube sticks out. You could wind up without enough space to clamp the stem. Also, will you need to transfer headset cups and/or bearings?
- Wheels: The front wheel can go if the fork fits, if not it just needs to fit the new fork. The rear wheel will need to have the same spacing and dropouts (135mm QR, thru-axle, 12x142mm, etc.).
- Brakes: You might need an adapter to mount the brakes, but these are pretty universal and should work on any bike. Also check to make sure the hoses are long enough if the new frame is longer.
- Cranks: Will work, but the bottom bracket must be of the same type (cups/pressfit) and size (68/73 or 83mm).
- Shifters: are similar to brakes in that they're universal but the cables might be too short.
- Front derailleur: Must be the same mounting type. The swing might be different, but it will work in some fashion, but maybe not the best.
- Rear derailleur/cassette: The cassette is dependent on the wheel fitting obviously, but the rear mech should work fine.
- Chain: I would say probably not, you'll have a slightly different chain size and it's a new bike, so might as well put on a new one. Plus, don't forget about the chain length change as the suspension moves through it's travel.
My recommendation is to compare the specs on both bikes and see how much is the same before deciding to swap all the components, as it will be a headache when you get halfway through the build and discover that you need to buy a different sized part! This is also a good time to upgrade components and evaluate wear.