"Cowards die many times before their deaths," try to imagine how someone can "die many times" before dying. You can tell right away that Shakespeare is using death as a metaphor (because no one can physically die more than once in their lifetime).
The second part of the quote: Shakespeare is implying that a brave person only dies once, which most likely refers to when he or she dies physically. So, in this part of the quotation, Shakespeare isn't using death as a metaphor.