It depends on how long you plan on waiting to purchase another home and how you intend to finance it.
If you're looking to go with a conventional mortgage the next time you buy a home, then a deed-in-lieu is treated pretty much the same as a short sale.
However, if you're looking to finance with FHA, VA or USDA, then a deed-in-lieu is treated the same as a foreclosure.
In general, a short sale will have less impact on your overall credit scores and credit history than a foreclosure or a deed-in-lieu. With a short sale, you may be able to purchase a home in as little as 2 years. However, with a foreclosure and a deed-in-lieu, the wait will depend on the amount of downpayment, and can be anywhere from as little as 2 years with 20% down to as much as 7 years with 10% down.
You should consult with an attorney who is experienced in handling these types of transactions so as to minimize the impact on your overall credit and to maximize your potential to purchase another home in as little time as possible.