Complete positivity of non-Markovian quantum dynamics