It depends which box you have. The V8 D2 uses the ZF4HP24EH IIRC, which I think is the same as that used on the P38, but the TD5 uses a ZF4HP22EH.
I guess swapping the ECU's should be simple enough, you may have to tell the Engine ECU the other box is fitted, I'm not sure, there is Auto control circuitry in the TD5 Auto ECU (indeed, a TD5 Auto ECU can be used in a Manual, but a Manual ECU cannot be used in an Auto).
Ashcrofts can make a ZF4HP22EH stronger with most of the bits from the 24, so they can't be too dissimilar. I'd try asking them if I were you. I'm running a stronger 22EH box (stage 1 IIRC with the C1/C2 clutch from the 24, as I chewed that up with my tuned TD5).