Algorithm Time complexity analysis for algorithm having two different time complexities
No, you can't determine the asymptotic worst-case running time from these two graphs.

First, plotting empirical running times is not a reliable way to determine worst-case running time: How to fool the plot inspection heuristic?.  So, the approach of graphing performance on some testcases isn't a reliable way to get a "big-O" running time.

Second, knowing just these two graphs isn't enough to uniquely determine how it depends as a function of both $N,M$.  There are multiple possibilities for functions $f(N,M)$ that are consistent with both of these graphs.  For example, a two-variable function $f(N,M)$ is not uniquely determined by the one-variable functions $f(100,M)$ and $f(N,100)$.

Third, I strongly suspect that those two graphs don't tell the whole story.  For instance, you show us only a single graph for when $N$ is held constant and $M$ is varied.  But I suspect the shape of the graph (or the slope of the line) might depend on exactly which constant value of $N$ you choose: a very large value of $N$ might lead to a different graph than a small value of $N$.  This further highlights that we don't have enough information to uniquely infer the running time.



So what should you do?  Rather than plotting running times and treating the algorithm as a black box, it's probably to start by looking at the algorithm itself.  Look at the pseudocode of the algorithm and analyze its worst-case running time using standard techniques.  See, e.g., Is there a system behind the magic of algorithm analysis? and How to come up with the runtime of algorithms?.  This allows mathematically rigorous analysis that is provably correct and that can analyze the running time for all combinations of $N,M$.