Transitions between critical kernels: from the tacnode kernel and critical kernel in the two-matrix model to the Pearcey kernel