The "D" code in box 12 relates to 401(k) contribution made by your employer to your retirement plan. (There should only be a code letter in box 12, the number may refer to the amount of your 401(k) contributions during the year.)
Both a 401(k) and a Traditional IRA are tax deferred types of retirement plans. However, you usually make 401(k) through your employer since these plans are generally set up by business. Whereas an IRA is a retirement plan that you can fund yourself and you can claim a deduction for contributions to an IRA up to $5,500 (or $6,500 for people over 50)
You will not be able to claim your 401(k) contributions listed on your W-2 as an IRA deduction.
For more information on retirement plans, please click on this link - https://www.irs.gov/retirement-plans