It's Dungeons and Dragons when whoever legally owns the brand name calls it Dungeons and Dragons.
Otherwise, it's any number of combination of arbitrary things that someone may "feel" is D&D, although no one's feeling is going to jive* completely with someone else's, and certainly not with gamers as a whole. < . . . snip . . . >
As aurance said, it is D&D when so branded.
However, having said that, I want to add this as well: there are certain features that make it recognizable as "D&D-the-fantasy-roleplaying-game," which taken together enhance the recognizability of the game; but, at the same time, there are also other brands of products which, having been inspired by D&D, also contain some or all of the same features.**
A partial list follows:
Classes: There are character classes and armor classes and difficulty classes.
Levels: There are experience levels and dungeon levels and spell levels and monster levels and challenge levels (or ratings).
Races: The players' characters could all be human; but each one could be a member of some other race, instead.
Platonic-Solid Dice: Even if the dice are simulated by computer programs or other aids, the probability distributions of the regular d4, d6, d8, d12, and d20 apply. (If the game also uses d10 and d100 dice, that doesn't throw this off.)
Items and Abilities, Magical and Mundane: Money and clothes and rations and staffs and wands and spells and potions and scrolls.
Weapons: Clubs, Daggers, Maces, Swords; maybe even Glaive-Guisarmes, for those who like such things.
Miscellany: cantrips, orisons, traps -- stuff like that.
Attributes: STR, CON, DEX, INT, WIS, CHA (in any order).
Bonuses and Modifiers and Penalties, because it's meant to be educational (do the arithmetic in your head).
Obscure or Fascinating Cultural References, because it's meant to be educational. Strange lands, dangerous monsters, vertiginous landscapes, natural hazards.
One Character Per Player (with exceptions): You're playing your
character instead of playing your group or your faction.
Monsters: Dragons are a must, but the entire litany contributes to the recognizability.
Alignment: The writings of Anderson and Moorcock must be served, so there's that. (Each particular group might decide how or whether they're actually going to use that stuff, but rules for alignment are included in the game.)
Medieval Fantasy: Alchemy but not gunpowder. Religion but not existentialism. Horses and folding boats. Flying carpets, but no cruise missiles. Magic Circles. Pact Magic. Wonder-working. War.
Combat: It's traditional in the game, so it must be included. (In that connection, Hit Points and Damage are also iconic.)
Mockery: Taunts. Unladen Swallows. Glede Wurp the Eyebiter. Bad puns. Anagrams.
Not required:
(-) Gold: Dark Sun has very little metal.
* "jibe," of course.
** I guess I'm saying that these features are not exclusive to D&D.