Self-consistent Green's function method for nuclei and nuclear matter