Effective Hamiltonian approach to the non-Markovian dynamics in a spin bath