To say the two have any similarities beyond the superficial would be absurd. These two goals definitively make execution different from imprisonment and, in some cases, more appropriate. Torture accomplishes them. Advocates of deterrence say that the best way to deter people is with a severe punishment, in this case death. Statistics strongly suggest that death is not a more effective deterrent than other forms of punishment.
Society commits murder entirely under the unsupportable assumption that it deters.
As Steven Nathanson states in An Eye for an Eye , if society must punish murder by killing, then it must also punish burglary by robbing or embezzlement by embezzling. Nothing requires that each punishment be exactly equal to the crime. What the justice system does require is that the punishment fit the crime. Each punishment must be proportionately severe to the crime. For example, a mass-murderer must not face only two weeks in a detention center.