A magnitude of 5.8 earthquake has struck parts of Afghanistan and Pakistan, with an epicentre about 150km east of the Afghan city of Kunduz.