You should be able to do it. The only difference being the rear output shaft, and the tailhousing.
Problem is..... how good are you at automatic transmission work?
In order for the swap to take place you have to completely disassemble both transmissions to swap out the transmission output shafts. I do mean TOTALLY disassembling the entire transmission. After you take all of the clutches out, there is a 12-point headed bolt that holds the center support in the case, and the valve body has to be removed to get to this bolt.
Also, be careful when you remove the valve body that you dont lose the 5~6 BBs that are in the case. These are actually check balls, but look like stainless steel BBs.
One other thing that may be different is if the 4x4 used the 6-bolt torque converter cover. These are kind of rare, but if your 2wd has the 4-bolt torque converter cover, nothing will be harmed by using it in the 4x4. The biggest problem is not being able to use the strut rods that connect to the engine mounts. But then again, your truck may not even have these, in which it is a non issue.