Follow-the-leader approximations of macroscopic models for vehicular and pedestrian flows