Catalyzes the conversion of (2E)-4-hydroxy-3-methylbut-2-enyl diphosphate + 2 H+ + 2 reduced - to isopentenyl diphosphate (IPP) and dimethylallyl diphosphate (DMAPP) releasing H2O + 2 oxidized -. Note that (E)-4-hydroxy-3-methylbut-2-en-1-yl diphosphate is an alternative name for 1-hydroxy-2-methyl-2-(E)-butenyl 4-diphosphate.
isopentenyl-diphosphate:NAD(P)+ oxidoreductase activity