He ran away from Shanks' haki, not Yonko level crews. When he came to Wano he very well knew that there would be a lot of strong guys: Luffy, Kid, Law, Zoro, Sanji, Yamato, Jinbe, Killer etc. Plus the entire Wano samurais that Akainu is so afraid of. So, please, the reason he ran away was because of Shanks' haki, he felt the strength and chickened out.