The specific transmission used depends heavily on engine size, options selected when the vehicles were manufactured, and even minor model year changes. Even if the transmissions appear outwardly similar, internal components, mounting points, and even the bellhousing (which connects to the engine) might be different enough to prevent a proper fit.
You should check the specific transmission codes on both vehicles (found on a tag on the transmission itself). Even with matching codes, a professional mechanic should assess compatibility before attempting the swap. The cost and complexity of making it work might outweigh the benefits.