When is a noun phrase an adverb phrase?
Let us begin by addressing your first question. The descriptor noun phrase refers, per Wikipedia, to "a phrase which has a noun (or indefinite pronoun) as its head word, or which performs the same grammatical function as such a phrase." Similarly, Merriam Webster tells us that a noun phrase is "formed by a noun and all its modifiers and determiners," or "any syntactic element...with a noun's function (as the subject of a verb or the object of a verb or preposition."
Now, a head word is the word that determines the syntactic role (part of speech) played by the phrase. Thus the general usage defines a noun phrase by its function: if it acts like a noun, it is a noun phrase. Note that Merriam-Webster's first definition instead defines a noun phrase as simply having a noun.
On the other hand, what does Wikipedia have to say about adverbial phrases?
"An adverbial phrase is a group of two or more words operating
adverbially, meaning that their syntactic function is to modify a
verb, an adjective, or an adverb."
Note that, as is generally the case with a noun phrase, an adverbial phrase is solely defined by its role. Consider the following sentences.
The Democatic debate is today.
We shall have a new president in two years.
I'll be so relieved
when the election is over.
We have three types of modifier here. The first is simply an adverb. The second is an adverb phrase. The third is an adverb phrase that happens to be an entire clause, or an adverbial clause. Observe that the adverb phrase contains a preposition, an adjective, and a noun: no adverb in sight. Indeed, many if not most adverb phrases are like this. Containing an adverb is not enough to make something an adverbial phrase: the whole phrase must function as an adverb, modifying an adjective, a verb, or another adverb.
So, what is the gist of the previous discussion? Generally, both noun and verb phrases are defined by function. Under this definition, the answer to "When is a noun phrase used as an adverb phrase?" is never. However, going by Merriam-Webster's first definition, which is more relevant to your question, the answer is whenever it modifies an adjective, verb, or adverb.
When is it necessary to place a preposition before a noun phrase used as an adverb?
Unfortunately, as in many such cases, it is unlikely that one rule prescribes when one should use or avoid prepositions in adverbial phrases.
Distance between the verb and the adverb phrase might be one factor:
She made the pickle a different way.
This sentence is unambiguous and fairly natural.
She made the pickle, with peppercorns and dill, sealed in an enormous jar, a different way.
This sentence is ambiguous, because "a different way" could either refer to "with peppercorns and dill, sealed in an enormous jar" or to something else entirely. It also sounds awkward. However, if we write
She made the pickle, with peppercorns and dill, sealed in an enormous jar, in a different way.
This is unambiguous (although the meaning would change if the adverb phrase were placed directly after "pickle." Also, "in a different manner" would probably be better here, but that is mostly a vocabulary choice.
Similarly, either "in a friendly way" or "a friendly way" would be appropriate in your second sentence. The use of a preposition is not really obligatory. However, if we separate "approach" and "friendly way" far apart, the sentence becomes clumsy and requires a preposition to avoid ambiguity.
A second factor is whether the noun phrase can actually stand alone as a noun. Consider your "both ways" example. This sentence makes no sense, at least in my dialect:
Look to both ways before you cross the road.
Look to up before you walk near that building under construction.
Look at around when you cross the street.
The preposition is effectively prohibited in these cases, because it gives the impression that the adverb or adverb phrase could stand alone as a noun, which is not the case. Essentially, "both ways" and similar phrases have been used so long that they have become one adverb in people's minds, thus the inappropriateness of a preposition.
This is probably the most important "rule." When words have become associated in an frequently used adverbial noun phrase, it seems extremely awkward to add a preposition: "both ways," "this way," "the hard way." In fact, many such phrases have become so common that they arguably should be classified as compound adverbs, not noun phrases. As Khan noted in a comment, The Free Dictionary classifies "both ways" as an adverb (or occasional adjective), as indeed does Dictionary.com.
You will rarely encounter someone who says: "Do you want to do this in the easy way, or in the hard way?"
But when such an association does not exist, a preposition is generally required. This is acceptable.
They arrived with an incredible noise.
This is not:
They arrived an incredible noise.
In fact, it may be that the ability to stand alone as a noun is the central factor here. What leads to awkwardness in this cases seems to be ambiguity. There is no chance of confusion when someone arrives "a confusing way." There is if someone arrives "a confusing fashion."
"Both ways," " a confusing way": these are not often seen out of their common role as adverb phrases. By contrast, "confusing fashion" is.
Another issue is which preposition is being elided (if indeed one is). "With" can rarely be omitted, as one of the previous examples showed, while "in" often can be
However, all these are merely heuristics. As other answerers have noted, there is not one hard-and-fast rule, or indeed set of rules, for determining when a preposition is required, and when it is not.