Quantum-state transfer between fields and atoms in electromagnetically induced transparency