(I know this is frowned upon, but given the comments I've received from the original poster, I've reworked my answer.)
To me, replacing both of these "に" with "で" sounds off.
As far as I've heard, "に" is usually taught as indicating the location at which something exists or the direction something moves in / its destination, and that you should use で for everything else, but this is an oversimplification of a very important aspect of what we use "に" for.
"に" can also be used to express where the result of some act or action is realized, i.e. the location of someone or something after having done something or having something done to it.
In more precise terms, when dealing with locations regardless of tense "に" expresses 1) static objectives/targets, i.e. where an action winds up or ends. It also is used to express 2) location when used with verbs of state or existence.
1) action verbs with a final location
彼はもう家に着いているはずだ。
The locative objective/target of the action of arriving is 家, hence "に".
荷物はここらへんに置いてもいいですか?
The action of placing something ends at ここらへん, hence we use "に".
テーブルに料理を並べた。
With a verb like "並べる", in much the same sense as "置く", the focus is on where the object(s) being handled wind(s) up.
2) stative/locative verbs
先生は黒板の前に立っている。
A verb like "to stand" in Japanese is as you mention in your comment a stative, or change-of-state, verb, i.e. a quote-unquote instantaneous action. It however can also be thought of a locative verb because the location of the subject is equally as important as the fact they are standing. This location is therefore expressed using "に".
公園にはとても綺麗な花が咲いている。
With a verb like "咲く", the object blooming changes from a closed to an open state, making it as well a change-of-state verb. To express the location of both this state and the change-of-state itself, we use "に".
3) other action verbs
最近は毎朝、近くの公園でジョギングするようにしている。
A verb like "to jog" in Japanese is not a stative verb nor is it a locative verb. The location you finish at is also not integral to the meaning of the verb. Therefore, when adding a location to the verb, the focus isn't on where the thing jogging is or where they finish jogging, but where the jogging is taking place. It is for this reason we use "で" or "を" over "に".