The tranny from the 2004 is probably hooked up to an LS Engine. Chances are it's probably a 4L60e also. However, it has a different size torque converter and will not fit behind the 5.7. You will need a conversion kit from GM which includes a Aluminum spacer to sandwich between the engine and tranny. It also includes longer alignment pins (the old ones are almost impossible to get out of the block) and spacers for the existing flywheel. You will also need an aftermarket dip stick cause the stock one will no longer reach since the tranny is moved back a bit.
My advice...get a tranny for the 5.7. I know because I went through this. Not worth it IMO.