When you buy the bonds directly, you're choosing an explicit exit date and you know exactly what your return will be.
When you buy a bond fund, your principal is going to be reinvested, so there's a risk of interest rates going up right before you sell.
Some firms offer target maturity bond funds which will is the best of both worlds.