Bear with me when that answer is a bit longer than expected. To really understand what is going on there are some prerequisites I have to explain first.
Every Kasus is a certain relation of a noun (or a pronoun standing in for it) to something else. For instance:
Ich gehe in das Haus.
Ich bin im Haus.
In the first example "Haus" is a direction, in the second one it is a place. One could also say
Das Dach des Hauses ...
and here "Haus" is something the "Dach" belongs to or is part of.
So far, this is perhaps what you already learned: "Akkusativ is a direction, Dativ is a place", etc.. But reality is a bit more complicated: in the indo-european Proto-language (PIE) there were 8 (maybe 9) different Kasus. Over time these Kasus were reduced and the remaining ones overtook the functions of the discontinued ones. For instance, Latin had still 6 of these 8 cases, but the Ablativus overtook the functions of the Instrumentalis, a case stating that with something the action described in the verb was performed. In English you'd say:
I hit the nail with the hammer.
and you'd use a preposition because English doesn't have an Instrumental. Basically the preposition is what you use if the language doesn't have a Kasus for the relationship you want to employ. In (some) Slav languages, for instance, this Kasus is retained and hence they'd say (Polish):
Uderzyłem młotkiem
and "młotkiem" is this Instrumentalis, it means "with the hammer". "The hammer" (Nominativ, the case for nouns used as the subject of a sentence) is "młot".
The question remains what Akkusativ and Dativ are for, especially in German. The Dativs original function was to signify the one who profits (or suffers) from the action in the predicate:
Ich gebe dem Beschenkten das Geschenk.
This is called Dativus commodi. With the redution of cases the Dativ has taken over the functions of the Ablativus and - since in Latin the Ablativus already had overtaken the functions of the Instrumentalis - this one as well. This is the historical reason why the preposition "mit" requires the Dativ. This is what English calls the "indirect object". The problem is that the Dativ has a lot more functions in German and they aren't covered at all by "indirect object":
- Dativus Iudicantis
Describes the POV, from which a certain fact is true. For instance:
Das Restaurant war mir zu teuer.
- Dativus Finalis
Describes a purpose, but is used very rarely nowadays. here is an example, meaning "I (only) live for my hobby":
Ich lebe meinem Hobby.
- Dativus Possessivus
Describes something/somebody to which some other thing/person belongs to:
Mir hilft mein Freund.
Notice that in earlier languages (Latin!) this was used much more widely. For instance, this means "he has a house", but the word-by-word translation is "him is (a/the) house":
Eum est domus.
- Akkusativ
This is arguably the most important object case. There are certain prepositions ("ohne", "durch", "gegen", "in", ...), verbs ("sehen", "lesen", ...) and a few adjectives which require this case ("government", in German "Rektion") and this is what translates (roughly) to the english "direct object".
Ich gebe dem Beschenkten das Geschenk.
But there are also other functions for the Akkusativ:
- Accusativus adverbialis
Describes timespans or ways, quite like adverbials:
Ich arbeite den ganzen Tag.
Das Kind wird den halben Weg getragen.
- Accusativus Obiectivus
Describes a congruence/equivalency between an Akkusativobjekt and something else:
Sie nannte den Mann einen Lügner.
The regular Akkusativobjekt is "einen Lügner" and "den Mann" is the Accusativus Obiectivus. It means the one and the other are the same, hence, he is (called) a liar.
Coming back to your question after this (I know, rather long-winded) introduction. Basically the two contructions in question are:
aufbauend auf dem (Dativ)
aufbauend auf das (Akkusativ)
Both are correct but - in a very strict sense - they mean different things. In the first one the Nomen in Dativ describes a thing to which something is added (by building on top of it):
I spendiere dem Haus ein Dach.
The roof is part of the house after it is built, it "belongs" to the house. Would the house be a person we would call it a "gift".
The Akkusativ describes the thing onto which is built upon as the foundation. The new thing which is built is just placed on top of it. It doesn't become part of the old thing but is placed somewhere - and this place is named in Akkusativ.