I am so very sorry for your loss. It's never easy to say goodbye, but it's somehow more difficult when it blindsides us out of nowhere, seemingly without explanation.
Without a necropsy it is impossible to tell what the reason was for your dog's death. Because he was so young, I would contact the breeder and let him or her know what happened because many breeders will stand by their puppies and will replace them in the event of an untimely death. If, however, you bought your puppy from a pet store or from a backyard breeder, there is probably nothing that can be done at this point. Pet store puppies and backyard breeder puppies, probably 99.9% of the time come from dogs that have not been health tested before they were bred, therefore my guess (and it's only that, just a guess) is that there was some sort of congenital problem that your dog was born with that finally took its toll after two years. It could have been a heart defect, it could have been anything.
Again, I am so very sorry for your loss. I wish I could offer you more of an explanation but as I said, without a necropsy, there is nothing that can be done.