As others have said, it's a big ole "depends." So I'm just going to kinda, mentally, run through the process of dungeon*-building...since there is definitely a general process though I don't know that a point-by-point follow in order can be set in stone.
*
The term "dungeon" shall be herein used interchangeably with the term "adventure" and in no way is limited to the literal concept of "dungeon" as a pre-constructed subterranean stone structure.
I might have an idea for a great "big bad" who needs a home or a player-driven plot device/point that needs to be met or a DM-driven plot device/point that needs to be covered or just a hankering for a particular terrain or desire to use a particular kind of monster that I haven't pulled out in a while...
I. Why? The Purpose.
So, I suppose the first step is to decide/determine what the purpose of the adventure is. Is this for the party to gather clues about the overarching plot? Is it to supple a way for the player to achieve some personal character goal? Is it the setting for the climactic battle with the campaign's big bad? Or a just a time-killer to get the PCs some XP in between plot-relevant dungeons? Is it a place in the world that the party might not even ever come across/have reason to visit?
II. Where? The Setting.
So, I know what I have/need this dungeon for. Where is it?
A. Location: (May or may not relate with I

urpose) Is this some place that the party is just going to find or are they going there for a particular reason? Is it nearby or will there be an extended journey (or require magic?) to get there?
----Do they know where it is or have to try to find it?
----Does it need a "wilderness" segment of the adventure or an "investigation/exploration" segment as the party searches where to go to get to the actual "A."? Are there rogues or rangers in the party who might gather information from their contacts? A diviner/seer/local witch who can scry? Is the party mage on good terms with the wizard's guild or the party cleric in good graces with the local temple to get help/direction/access to archives? Heck, Are any of the PCs
from this area and know exactly where they're going?
B. Terrain & Climate: Is this dungeon in the mountains? Under the mountains? The swamp? The woods? The arctic tundra or burning dessert? Is it the height of the summer thunderstorm season? Early spring downpours? A calm but cold winter? Will winds be hampering travel [if, for example, travel by ship - or flight?- is necessary]?
C: The Map
. If necessary, a map of the general region/area to be traveled and then placing possible random/side-encounters or legitimate patrols/sentries, regional treats, "animal monsters" appropriate to the climate and terrain, etc...
So, as you can see, establishing the "Where" can take some time and may, very well, generate NPCs or monster-encounter ideas as well as contribute, if not dictate, the overall length of a particular dungeon by virtue of where the setting 1) is and 2) is in relation to the party's current location.
III. What? The Structure.
When the party gets there they will find...? Burial Barrow Mound or Elaborately Trapped Tomb? Abandoned Temple? UNabandoned Temple? Abandoned or Functioning Outpost/Moathouse/Fortress/Castle/Citadel? Natural Cave-Cavern complex? Enchanted [or Cursed?] Forest? Cloud Castle? Underwater Domed City?
A. Map. Definitely necessary at this point and, depending on the type of dungeon (from 5-roomer to multi-layered mega), likely more than one/per level.
If a constructed structure, then, as a recent thread around here talked about, it is drawn out as "makes sense." What was it constructed for? Obviously a burial mound doesn't need a kitchen or latrine...unless you're working with a culture who believes such things necessary for the deceased or, perhaps, has a culture which includes living servants/guardians of their dead be assigned to each mound...hm...[mental notes.mental notes.] A castle, on the other hand, does not (normally) have a lot of superfluous space whereas a natural cavern/cave complex might have a narrow winding passage that goes on for hundreds of feet...to open to a massive space...with nothing in it.
IV. Who? The Inhabitants.
Once again, this might be determined to some extent by I and to a large extent by II and III. If this is the dungeon of the "big bad" then that's who's here along with any/everything that serves him/her/it. If it's some outpost of the enemy's forces, then some [possibly established by some prior dungeon] minion/soldier types are a given. If the dungeon is in the heart of a volcano, there will not be Frost Giants or Winter Wolves roaming the halls; the expedition to "The Floating Castle of the Cloud King" is not going to include Mermen and Merrow; SO...
A. What creatures make sense for the purpose of this dungeon?
B. What creatures make sense for this structure?
C. What creatures make sense for this climate and terrain?
V. When 1? The Tricks.
When not fighting the inhabitants, the party encounters...? Most, if not all, of this is dependent on IV and III. Is it a kobold infested mine? There will be traps and/or locations for ambush set-ups. Is this an ancient archmage's ruined tower? Puzzles with Magical effects [for failure and/or success?]. The harpy or sphinx that demands a challenge of riddles. Illusions, Sliding walls and Secret Passages, Teleportal Circles (whether obvious or secret/traps), Spike-bottomed pits and golden chandeliers that sing clues to the "hidden treasure room" [which is really the Chamber of Unspeakable Certain Doom].
A. Traps. What and Where?
B. Puzzles & Riddles. When and What do you get (for success? for failure?)
C. Hidden doors, passages, chambers.
D. Magical tricks, illusions or effects.
VI. When 2? The Treasure.
When they are successful in the dungeon, the party receives...? Obvious. What and how much, where and with whom?
This includes [and should be considered just as carefully] not just the placement/amounts of coins, gems, and magic items, but the valuable art works (paintings, statues, etc...), mundane marketable goods (barrels of good wines, bolts of silk, etc...), and/or [for lack of a better term] "mystical" effects and ingredients: books/manuals of rare topics (arcane or otherwise that the local sage might be interested in), alchemical equipment (beakers, tubes, rare minerals, liquid mercury, etc...), the jar of phoenix feathers that the mage PC needs to make that Wand of Fire or some pickled cockatrice beak for the "Stone to Flesh" antidote/potion they've been talking about, etc...
VII. [Optional] How? The Ecology a.k.a. "Making More Sense."
This step really is just an optional/extra layer if you have the interest, inkling, talent and time. It does harken back, to an extent, to IV and III. Both constructed and natural settings need a convenient water source, entrance/egress points for whatever lives there that would need to get out/go hunting, etc... Some loose/plausible ecology even if not integral to the story of the dungeon or the outcome...It should be unspoken/obvious that the pair of lions lounging in this cave hunt in the surrounding territory [because you put woods or grasslands aroudn the cave]...If they're chained to the spot or are not in a region that would produce huntable prey for lions...What do they eat? Who chained them? Who feeds them or let's them loose to go feed? The bats in the lower caverns exit at dusk to feed on insects while the giant cave snake you just killed was happy to snack on bats when it couldn't get anything else.
For some dungeons this is more necessary, others it is not. Some groups find it interesting and immersion helping and others don't. Some DMs are great at it, some just aren't, some are annoyingly and irrelevantly detailed. Some players love it or hate it/find it distracting or unnecessary. This is really a group-by-group, case-by-case, dungeon-by-dungeon kind of thing.
I think...that more or less covers my process. As you see, some elements are dependent on others so making 1 dungeon might just go 1-7 in order. Another might be 1-2-3-5-4-6. The dungeons where the "1" IS the "6" macguffin, or when I get an idea for an AWESOME "3" for a one-shot and the rest all flows from there.
But, yeah, I think these 7 cover my process/outline.