A Structure-Preserving Kernel Method for Learning Hamiltonian Systems