The effective two-loop Euler-Heisenberg action for scalar and spinor QED in a general constant background field